package com.wcbtest.webs;

import com.jcraft.jsch.Channel;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;

public class JSchUtils2 {
    public static com.jcraft.jsch.Session initJschSession() throws JSchException {
        System.out.println("开始初始化服务器 ");
        String host = "192.168.110.130";
        String user = "root";
        String password = "123456";
        int port = 22; // SSH默认端口是22

        JSch jsch = new JSch();
        com.jcraft.jsch.Session jschSession = jsch.getSession(user, host, port);
        jschSession.setPassword(password);
        jschSession.setConfig("StrictHostKeyChecking", "no"); // 可选，避免首次连接时需要手动确认密钥
        jschSession.connect();
        System.out.println("初始化服务器 => " + host);
        return jschSession;
    }
    public static  Channel initJschShellChannel(com.jcraft.jsch.Session jschSession,String type) throws JSchException {





        return null;
    }





}
